# -!- coding: utf-8 -!-
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
调用业务系统内部接口的响应信息respond
# 文件：systemResult.py
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

from pycacho.cachobase.logger import Logger

logger = Logger("riskResult").get_log()


# 业务系统授信规则处理请求参数
credit_request = {
        "creditAddress":"北京",
        "creditAge":25,
        "creditAppId":"HB",
        "creditApplyIp":"",
        "creditApplyModelCode":"",
        "creditBankCardName":"工商",
        "creditBankCardNo":"3292384298452",
        "creditBankMblNo":"18873827382",
        "creditCompanyName":"",
        "creditContactMblNo":"18873827382",
        "creditContactName":"陈智智",
        "creditContactRelation":"004",
        "creditCusSex":1,
        "creditHbUsrNo":"99522327199408182217",
        "creditInCome":"002",
        "creditLiveScore":"90",
        "creditMaritalSta":"1",
        "creditMblNo":"18748804048",
        "creditOprId":"",
        "creditRegDt":"20190708000000",
        "creditSchooling":"004",
        "creditSocialIdentity":"001",
        "creditTotalBonusAmt":-989,
        "creditUserMail":"",
        "creditUsrIdCard":"522327199408182217",
        "creditUsrIdName":"覃波",
        "creditUsrJob":"",
        "idcard":"522327199408182217",
        "mobile":"18748804048",
        "name":"覃波",
        "processNo":"CW20190912HB000005"
}

# 业务系统传入授信信息到决策引擎
credit_rule =  {
        "baiRongTelConsume":"-989",
        "baiRongTelOperation":"-989",
        "baiRongTelPeriod":"-989",
        "baiRongTelStatus":"-989",                    # 规则引擎：MDV018=100 值=2或者3或者4
        "creditAddress":"北京",
        "creditAddressCityCode":"DEFAULT",            # 规则引擎：SameCity=Y creditCompanyAddressCityCode==creditAddressCityCode
        "creditAge":"28",
        "creditAppId":"HB",
        "creditApplyIp":"DEFAULT",
        "creditApplyModelCode":"DEFAULT",
        "creditBankCard4Verify": "Y",                 # 规则引擎：银行卡四要素验证是否一致-20191016V2.3
        "creditBankCardName":"工商",
        "creditBankCardNo":"3292384298452",
        "creditBankMblNo":"18873827382",
        "creditBlkBankCardHitBankCard":"-989",        # 授信-客户银行卡号码命中黑名单银行卡号码
        "creditBlkBankMblNoHitMblNo": "0",            # 授信-目标客户银行卡绑定手机号命中黑名单手机号（bankMblNo）-2019123# V3.5
        "creditBlkDeviceidHitDeviceid":"-989",        # 授信-客户设备ID命中黑名单设备ID
        "creditBlkDirectContactHitMblNo":"-989",      # 授信-客户直系联系人命中黑名单手机号（contactMblNo）
        "creditBlkIdCardHitIdCard":"-989",            # 授信-客户身份证命中黑名单身份证
        "creditBlkMblNoHitMblNo":"-989",              # 授信-客户手机号命中黑名单手机号（mblNo）
        "creditBlkNo2ContactHitMblNo":"-989",         # 授信-目标客户第二联系人命中黑名单手机号（contactMblNo1）-2019123# V3.5
        "creditCompanyAddressCityCode":"DEFAULT",     # 规则引擎：SameCity=Y creditCompanyAddressCityCode==creditAddressCityCode
        "creditCompanyName":"DEFAULT",
        "creditContactMblNo":"13100000010",
        "creditContactMblNo1":"DEFAULT",              # 第二个紧急联系人contactMblNo1(授信)-20190927
        "creditContactMblNo1History":"1",             # 规则引擎：CON004=100  10<=值 第二紧急联系人电话历史出现次数
        "creditContactMblNo1Last1H":"1",              # 规则引擎：CON002=100  5<=值  第二个紧急联系人contactMblNo电话近1小时出现次数-20190927
        "creditContactMblNo1NamePhoneCheck":"DEFAULT",# 第二紧急联系人姓名手机二要素验证是否通过-20191016V2.3
        "creditContactMblNoHistory":"1",              # 规则引擎：CON003=100  10<=值 紧急联系人电话历史出现次数
        "creditContactMblNoLast1H":"1",               # 规则引擎：CON001=100  5<=值  紧急联系人contactMblNo电话近1小时出现次数-20190927
        "creditContactMblNoNamePhoneCheck": "N",      # 紧急联系人姓名手机二要素验证是否通过-20191016V2.3
        "creditContactName":"陈智智",
        "creditContactRelation":"004",
        "creditCusSex":"1",
        "creditHbUsrNo":"99220381199102110013",
        "creditIdCardPD": "734",                      # 规则引擎：身份证有效期到期日距今天数-20191016V2.3
        "creditIdCardPicVerifyResult": "DEFAULT",     # 规则引擎：身份证头像照片有源比对结果-pro_hb_image.id_card_front_id-20191018V2.4 下线-20191028v2.6
        "creditIdCardPicVerifyScore": "0",            # 规则引擎：身份证头像照片有源比对相似度-20191018V2.4 下线-20191028v2.6
        "creditIdExpDt":"DEFAULT",
        "creditInCome":"002",
        "creditLiveScore":"90",
        "creditLivenessPicVerifyResult": "DEFAULT",   # 规则引擎：活体截图有源比对结果-pro_hb_image.live_picture_id-20191018V2.4 下线-20191028v2.6
        "creditLivenessPicVerifyScore": "0",          # 规则引擎：活体截图有源比对相似度-20191018V2.4 下线-20191028v2.6
        "creditMaritalSta":"1",
        "creditMblNoV2":"15774412020",
        "creditOperator3Verify": "Y",                 # 规则引擎：运营商三要素验证是否一致-20191016V2.3
        "creditOprId":"DEFAULT",                      # 营业员编号oprId
        "creditOprMblNo": "DEFAULT",                  # 营业员手机号oprMblNo-20190926
        "creditRegDt":"20190708000000",
        "creditSchooling":"004",
        "creditSocialIdentity":"001",
        "creditTimeHour":"3",                         # 授信时间（时）-20191010
        "creditTotalBonusAmt":"-989",
        "creditUserMail":"DEFAULT",
        "creditUsrIdCardV2":"220381199102110013",
        "creditUsrIdName":"方春雨",
        "creditUsrJob":"DEFAULT",
        "creditUsrProvNo": "01",                      # 规则引擎：GLV017=100  值=='05'   用户归属省份usrProvNo-20190926
        "idcard":"220381199102110013",
        "mobile":"15774412020",
        "name":"方春雨",
        "processNo":"CW20190911HB000009",
        "tencentCloudBankCard4Verify":"N",             # 腾讯云银行卡四要素核验-20191213V3.4
        "tencentIdCardPicVerifyResult": "成功",        # 腾讯身份证人脸认证-20191028V2.6
        "tencentIdCardPicVerifyScore": "97.14",        # 腾讯身份证人脸认证-20191028V2.6
        "tencentLivenessPicVerifyConfidence": "98.1",  # 腾讯活体人脸认证-20191025V2.5
        "tencentLivenessPicVerifyResult": "成功",      # 腾讯活体人脸认证-20191025V2.5
        "tencentRiskCode1101": "N",                    # 规则引擎：NLI022   Y=100
        "tencentRiskCode1102": "N",                    # 规则引擎：NLI023   Y=100
        "tencentRiskCode1103": "N",                    # 规则引擎：NLI024   Y=100         疑似资料仿冒行为
        "tencentRiskCode1104": "N",                    # 规则引擎：NLI025   Y=40          疑似营销活动欺诈
        "tencentRiskCode1105": "N",                    # 规则引擎：NLI026   Y=10          疑似身份信息不符
        "tencentRiskCode1106": "N",
        "tencentRiskCode1107": "N",
        "tencentRiskCode1108": "N",                    # 规则引擎：NLI029
        "tencentRiskCode1201": "N",                    # 规则引擎：NLI030   Y=40          疑似风险设备环境
        "tencentRiskCode3101": "N",                    # 规则引擎：NLI031   Y=40          疑似异常支付行为
        "tencentRiskCode3103": "N",
        "tencentRiskCode3104": "N",
        "tencentRiskCode3202": "N",                    # 规则引擎：NLI034   Y=80          疑似账号被盗风险
        "tencentRiskScore": "-989",                    # 规则引擎：CSV001=100   值 >= 90
        "tongDunEmailNumberCount":"0",
        "tongDunFraudPoints":"20",                     # 规则引擎：CSV002=100   值 >= 80  同盾欺诈分
        "tongDunFuzzyList":"N",                        # 规则引擎：NLI0010  Y=20   身份证_姓名命中法院结案模糊名单
        "tongDunIdNumberCount":"0",
        "tongDunIdNumberHighFocusList":"N",            # 规则引擎：NLI0021  Y=40 tongDunIdNumberHighFocusList+tongDunPhoneHighFocusList都为Y   身份证命中高风险
        "tongDunJusticeRepresentList":"N",             # 规则引擎：NLI0018  Y=60   手机号命中欠款公司法人代表名单
        "tongDunLoseFuzzyList":"N",                    # 规则引擎：NLI0005  Y=100
        "tongDunLoseList":"N",                         # 规则引擎：NLI0009  Y=100
        "tongDunLowFocusList":"N",                     # 规则引擎：NLI0019  Y=5    申请人信息命中低风险关注名单
        "tongDunMiddleFocusList":"N",                  # 规则引擎：NLI0020  Y=0    申请人信息命中中风险关注名单
        "tongDunOneMonthPlatfromNumber":"0",           # 规则引擎：MHU004=5 3<=值<=6; MHU005=10 7<=值<=11; MHU006=100  12<=值  1个月内申请人借贷申请平台数
        "tongDunOverdueFuzzyList":"N",                 # 规则引擎：NLI0004  Y=60    身份证_姓名命中信贷逾期模糊名单
        "tongDunOverdueList":"N",                      # 规则引擎：NLI0003  Y=100
        "tongDunOwingHistory":"N",                     # 规则引擎：NLI0014  Y=40    身份证对应人存在助学贷款欠费历史
        "tongDunOwingTaxesList":"N",                   # 规则引擎：NLI0012  Y=100
        "tongDunPerformFuzzyList":"N",                 # 规则引擎：NLI0006  Y=100
        "tongDunPerformList":"N",                      # 规则引擎：NLI0002  Y=100
        "tongDunPhoneHighFocusList":"N",               # 规则引擎：NLI0021  Y=40   tongDunIdNumberHighFocusList+tongDunPhoneHighFocusList都为Y   手机号命中高风险
        "tongDunPhoneNumberCount":"0",
        "tongDunPhoneOverdueList":"N",                 # 规则引擎：NLI0016  Y=100
        "tongDunPhoneRepaymentList":"N",               # 规则引擎：NLI0017  Y=60   手机号命中信贷逾期后还款名单
        "tongDunRepaymentList":"N",                    # 规则引擎：NLI0013  Y=40   身份证命中信贷逾期后还款名单
        "tongDunRepresentList":"N",                    # 规则引擎：NLI0011  Y=100
        "tongDunSettleLawsuitList":"N",                # 规则引擎：NLI0015  Y=100
        "tongDunSpuriousLibrary":"N",                  # 规则引擎：NLI0007  Y=100
        "tongDunThreeMonthIdNumberCount":"0",
        "tongDunThreeMonthPhoneCount":"0",
        "tongDunThreeMonthPlatfromNumber":"0",         # 规则引擎：MHU007=5 5<=值<=11; MHU008=10 12<=值<=23; MHU009=100 24<=值  3个月内申请人借贷申请平台数
        "tongDunThreeMonthSpouseIdNumberCount":"0",
        "tongDunThreeMonthSpousePhoneCount":"0",
        "tongDunTrumpetLibrary":"N",                   # 规则引擎：NLI0008  Y=100
        "tongDunWantedList":"N",                       # 规则引擎：NLI0001  Y=100
        "tongDunWeekPlatfromNumber":"0",               # 规则引擎：MHU001=5较多 3=值; MHU002=10过多 4<=值<=5; MHU003=100极多 6<=值  7天内申请借贷申请平台数
        "tongDunWisdomLetterPoints":"-989",
        "tongDunWisdomWasPoints":"-989"
    }


# 黑名单匹配response
blackList = {
    "code": "0000",
    "date": 1568603850101,
    "msg": "交易成功",
    "bizJson":[
        {
            "beginDate":1567440000000,
            "blacklistDes":"直系联系人电话",
            "blacklistType":"RelativeContact",
            "blacklistValue":"18873827382",
            "endDate":1568476800000,
            "hitCode":None,
            "hitMsg":None,
            "outUniqueCode":"A00000000000066",
            "priority":2,
            "ruleCode":"HBL_ZPCP001_001",
            "ruleDes":"目标客户直系联系人命中黑名单手机号",
            "stage":"贷前",
            "status":"0",
            "statusMsg":"成功"
        },
        {
            "beginDate":None,
            "blacklistDes":None,
            "blacklistType":"Phone",
            "blacklistValue":"18252501238",
            "endDate":None,
            "hitCode":None,
            "hitMsg":None,
            "outUniqueCode":None,
            "priority":0,
            "ruleCode":None,
            "ruleDes":None,
            "stage":None,
            "status":"1",
            "statusMsg":"查无命中数据"
        }
    ]
}

# web页面公共返回参数
web_result = {
    "code":0,
    "msg": "成功",
    "detail":{
        "result":{
            "count":2,
            "pageIndex":1,
            "pageSize": 50,
            "totalPage": 1,
            "pageList":[
                {
                    "createTime":"2019-09-06 23:11:17",
                    "idCard":"441481199412012272",
                    "name":"曾君伟",
                    "phone":"13202480788",
                    "productCode":"zyd",
                    "usrNo":"YH20190906000001"
                },
                {
                    "createTime":"2019-09-06 04:20:13",
                    "idCard":"44538119951008784X",
                    "name":"谭婷玉",
                    "phone":"13534461573",
                    "productCode":"zyd",
                    "usrNo":"YH20190905000001"
                }
            ],
        }
    },
}
